home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / swingall.jar / javax / swing / plaf / basic / BasicTreeUI$TreeScrollLRAction.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-07-15  |  2.0 KB  |  48 lines

  1. package javax.swing.plaf.basic;
  2.  
  3. import java.awt.Rectangle;
  4. import java.awt.event.ActionEvent;
  5. import javax.swing.AbstractAction;
  6. import javax.swing.tree.TreePath;
  7.  
  8. class BasicTreeUI$TreeScrollLRAction extends AbstractAction {
  9.    // $FF: synthetic field
  10.    private final BasicTreeUI this$0;
  11.    protected int direction;
  12.    private boolean addToSelection;
  13.  
  14.    public BasicTreeUI$TreeScrollLRAction(BasicTreeUI var1, int var2, String var3, boolean var4) {
  15.       this.this$0 = var1;
  16.       this.direction = var2;
  17.       this.addToSelection = var4;
  18.    }
  19.  
  20.    public void actionPerformed(ActionEvent var1) {
  21.       if (this.this$0.tree != null && this.this$0.getRowCount(this.this$0.tree) > 0 && this.this$0.treeSelectionModel != null) {
  22.          Rectangle var4 = this.this$0.tree.getVisibleRect();
  23.          TreePath var3;
  24.          if (this.direction == -1) {
  25.             var3 = this.this$0.getClosestPathForLocation(this.this$0.tree, var4.x, var4.y);
  26.             var4.x = Math.max(0, var4.x - var4.width);
  27.          } else {
  28.             var4.x = Math.min(Math.max(0, this.this$0.tree.getWidth() - var4.width), var4.x + var4.width);
  29.             var3 = this.this$0.getClosestPathForLocation(this.this$0.tree, var4.x, var4.y + var4.height);
  30.          }
  31.  
  32.          this.this$0.tree.scrollRectToVisible(var4);
  33.          if (this.addToSelection) {
  34.             BasicTreeUI.access$7(this.this$0, var3);
  35.          } else if (BasicTreeUI.access$8(this.this$0)) {
  36.             this.this$0.tree.setSelectionPath(var3);
  37.          } else {
  38.             BasicTreeUI.access$6(this.this$0, var3, true);
  39.          }
  40.       }
  41.  
  42.    }
  43.  
  44.    public boolean isEnabled() {
  45.       return this.this$0.tree != null && this.this$0.tree.isEnabled();
  46.    }
  47. }
  48.